﻿@inject IStringLocalizer<Downloads> Localizer
@inject IOptionsMonitor<WebsiteOptions> SiteOptions
@inject DownloadService DownloadService
@inject ToastService ToastService

<Button IsAsync="true" Icon="fa-solid fa-download" Text="@Localizer["DownloadFolderButtonText"]" OnClickWithoutRender="DownloadFolderAsync"></Button>

@code {
    private async Task DownloadFolderAsync()
    {
        try
        {
            await DownloadService.DownloadFolderAsync("test.zip", SiteOptions.CurrentValue.WebRootPath);
        }
        catch (FileNotFoundException msg)
        {

            await ToastService.Error("下载", msg.Message);
        }
    }
}
